import pandas as pd
def get_train(data,baifenbi=0.7):
    userId = data['userId'].unique()
    movieId=data['movieId'].unique()
    train=pd.DataFrame()

    for i in userId:
        row=data[data['userId']==i].head(1)
        train = pd.concat([train, row])



    for i in movieId:
        row = data[data['movieId'] == i].head(1)
        train = pd.concat([train, row])

    train = pd.concat([train, data.sample(int(data.shape[0] * 0.7))])

    train=train.drop_duplicates()
    test = data.drop(train.index)
    return (train,test)